<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>插槽</h2>
      <!-- <child>hello!</child> -->
      <!-- <child>{{str}}</child> -->

      <!-- 可以在slot标签中间写内容，作为插槽的默认值 -->
      <child></child>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;
      const Child = {
        template: `
          <div>这是child子组件 - <slot>world!</slot></div>
        `,
      };

      const app = createApp({
        data() {
          return {
            str: "hello!!",
          };
        },
        components: {
          Child,
        },
      });

      app.mount("#app");
    </script>
  </body>
</html>
